//-----------------------------------------------------------------------
// <copyright file="CompanyAndMajorService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class CompanyAndMajorService
    {
        #region CompanyAndMajor

        public static void CreateCompanyAndMajor(CompanyAndMajor companyAndMajor)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                companyAndMajorDAO.CreateCompanyAndMajor(companyAndMajor);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateCompanyAndMajorException, ex);
            }
        }        

        public static void UpdateCompanyAndMajor(CompanyAndMajor companyAndMajor)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                companyAndMajorDAO.UpdateCompanyAndMajor(companyAndMajor);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateCompanyAndMajorException, ex);
            }
        }        

        public static void DeleteCompanyAndMajor(int companyAndMajorID)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                companyAndMajorDAO.DeleteCompanyAndMajor(companyAndMajorID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteCompanyAndMajorException, ex);
            }
        }
        
        public static CompanyAndMajor GetCompanyAndMajor(int companyAndMajorID)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                return companyAndMajorDAO.GetCompanyAndMajor(companyAndMajorID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndMajorException, ex);
            }
        }                

        public static CompanyAndMajorCollection GetCompanyAndMajorList(CompanyAndMajorColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                return companyAndMajorDAO.GetCompanyAndMajorList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndMajorListException, ex);
            }
        }        

        public static CompanyAndMajorCollection GetCompanyAndMajorList(CompanyAndMajorColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                return companyAndMajorDAO.GetCompanyAndMajorList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndMajorListException, ex);
            }
        }        

	    public static CompanyAndMajorCollection GetCompanyAndMajorListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                return companyAndMajorDAO.GetCompanyAndMajorListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndMajorListException, ex);
            }
        }        

        public static CompanyAndMajorCollection GetCompanyAndMajorListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                CompanyAndMajorDAO companyAndMajorDAO = new CompanyAndMajorDAO();
                return companyAndMajorDAO.GetCompanyAndMajorListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndMajorListException, ex);
            }
        }        

        #endregion
    }
}